/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.Cookie;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import javax.servlet.http.HttpSession;
/*    */ import net.sf.json.JSONObject;
/*    */ 
/*    */ public class AppLogout extends AbstractAction
/*    */ {
/*    */   public AppLogout(AbstractHttpServlet servlet)
/*    */   {
/* 22 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 28 */     HttpSession session = request.getSession(false);
/* 29 */     if (session != null) {
/* 30 */       session.invalidate();
/*    */     }
/*    */ 
/* 33 */     Cookie cookie = new Cookie("sessionKey", "");
/* 34 */     cookie.setMaxAge(0);
/* 35 */     response.addCookie(cookie);
/*    */ 
/* 37 */     response.setContentType("text/html;charset=utf-8");
/* 38 */     PrintWriter out = response.getWriter();
/* 39 */     JSONObject jsonObject = new JSONObject();
/* 40 */     jsonObject.put("error", "0");
/* 41 */     out.println(jsonObject);
/* 42 */     out.flush();
/* 43 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.AppLogout
 * JD-Core Version:    0.6.1
 */